/**
 * Choicesoft.com.cn Inc.
 * Copyright (c) 2004-2018 All Rights Reserved.
 */
package com.test.springboot;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

/**
 * @author chenxubing
 * @version $Id: Sender.java, v 0.1 2018-11-08 4:38 PM chenxubing Exp $$
 */
@Component
public class Sender {
    @Autowired
    private KafkaTemplate<String,String> template;

    @Value("${spring.kafka.consumer.topic}")
    private String topic;

    public void send(String msg) {
        template.send(topic,msg);
        System.out.println("send " + msg);
    }
}
